package module.map.model
{
	import drongo.desktop.utils.GUID;
	import drongo.model.propertys.NumberProperty;
	import drongo.model.propertys.StringProperty;
	import drongo.model.values.CollectionValue;

	public class NodeTypes
	{
		public static const PATH:int = 0;
		public static const AREA:int = 1;
		public static const IMAGE:int = 2;
		public static const TOWER:int = 3;

		public function NodeTypes()
		{
		}

		/**
		 * 创建节点数据
		 */
		public static function CreateNode(type:int, name:String, x:Number, y:Number):CollectionValue
		{
			var node:CollectionValue = new CollectionValue();
			// 类型
			node.Add(new NumberProperty(Propertys.TYPE, type));
			// 唯一ID
			node.Add(new StringProperty(Propertys.ID, GUID.getNextId()));
			// 名称
			node.Add(new StringProperty(Propertys.NAME, name));
			// XY
			node.Add(new NumberProperty(Propertys.X, x));
			node.Add(new NumberProperty(Propertys.Y, y));

			// 是否可见，是否锁定
			node.Add(new NumberProperty(Propertys.VISIBLE, 1));
			node.Add(new NumberProperty(Propertys.LOCK, 0));
			// 是否处在编辑模式下
			node.Add(new NumberProperty(Propertys.EDIATRO_MODE, 0));
			return node;
		}

		public static function CreatePoint():CollectionValue
		{
			var result:CollectionValue = new CollectionValue();
			result.Add(new StringProperty(Propertys.ID, GUID.getNextId()));
			result.Add(new NumberProperty(Propertys.X));
			result.Add(new NumberProperty(Propertys.Y));
			result.Add(new NumberProperty(Propertys.WIDTH,100));
			return result;
		}
	}
}